Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWC-6669: migrate legacy EntityViewScopeEditor to react component #5309

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

jinjunoh
Copy link
Collaborator

  • create respective components for EntityViewScopeEditorModal (props, view, impl, test)
  • modify existing ScopeWidgetTest

return props;
}
}
// TODO: create EntityViewScopeEditorModalWidget, View, and IMPL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// TODO: create EntityViewScopeEditorModalWidget, View, and IMPL

private String entityId;
private EntityViewScopeEditorModalProps.Callback onCancel;
private EntityViewScopeEditorModalProps.Callback onUpdate;
boolean open;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to store open because you are always using the passed parameter.

Suggested change
boolean open;

EntityContainerListWidget viewScopeWidget, editScopeWidget;
SynapseAlert synAlert;
EntityContainerListWidget viewScopeWidget;
EntityViewScopeEditorModalWidget editEntityViewScopeModalWidget; // TODO: replace edit scope widget with the react compoenent widget & fix corresponding test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EntityViewScopeEditorModalWidget editEntityViewScopeModalWidget; // TODO: replace edit scope widget with the react compoenent widget & fix corresponding test
EntityViewScopeEditorModalWidget editEntityViewScopeModalWidget;

String entityId,
EntityViewScopeEditorModalProps.Callback onUpdate,
EntityViewScopeEditorModalProps.Callback onCancel,
boolean open
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency with SqlDefinedEditorModalWidget.java, recommend removing open from the configure signature and making the initial value of the prop false.

() -> {
editEntityViewScopeModalWidget.setOpen(false);
},
true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this if you change the signature as suggested above.

If you did keep this, then the setOpen below is redundant

}

@Test
public void testConstruction() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void testConstruction() {
public void testConfigure() {

);
onCancelArgumentCaptor.getValue().run();
verify(mockEntityViewScopeEditorModalWidget).setOpen(false);
}
Copy link
Contributor

@nickgros nickgros Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would pass if you had a bug where onCancel ended up being misconfigured to call what was supposed to be the onUpdate prop. Just to make sure the correct callback was called, you should make sure fireEvent was never called.

Suggested change
}
verify(mockEventBus, never()).fireEvent(any(EntityUpdatedEvent.class));
}

Comment on lines 242 to 243
onUpdateArgumentCaptor.capture(),
onCancelArgumentCaptor.capture(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you aren't using the captors, you can just do

Suggested change
onUpdateArgumentCaptor.capture(),
onCancelArgumentCaptor.capture(),
any(EntityViewScopeEditorModalProps.Callback.class),
any(EntityViewScopeEditorModalProps.Callback.class),

@jinjunoh jinjunoh requested a review from nickgros February 29, 2024 21:59
Copy link
Contributor

@nickgros nickgros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, need an SRC release that includes Sage-Bionetworks/synapse-web-monorepo#756 to merge

@nickgros nickgros merged commit 27e1b01 into Sage-Bionetworks:develop Mar 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants